<!--/**
 * Plugin Name: 论坛展示型app
 * Description: uloug.com To develop and share! Please keep the copyright information!
 * Author: 拾讯网
 * Author URI: http://www.uloug.com
 * Version: 1.0
 * Plugin URI: https://git.oschina.net/858598758/apicloud.mao10.app.demo.git
 * License: GPL2+
 */-->
<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
	</head>
	<body>
		<header class="aui-bar aui-bar-nav aui-bar-warning" id="aui-header">
			<a class="aui-pull-left" tapmode onclick="closeWin()"> <span class="aui-iconfont aui-icon-left"></span></a>
			<div class="aui-title" id="header-title">
				拾味商城
			</div>
			<a class="aui-pull-right" tapmode onclick="news()"> <span class="aui-iconfont aui-icon-message"></span></a>
		</header>
		<footer class="aui-nav" id="aui-footer">
			<ul class="aui-bar-tab">
				<li class="active-warning" id="tabbar1" tapmode onclick="randomSwitchBtn(this,'商城',0)">
					<span class="aui-iconfont aui-icon-home"></span>
					<p>
						商城
					</p>
				</li>
				<li id="tabbar2" tapmode onclick="randomSwitchBtn(this,'分类',1)">
					<span class="aui-iconfont aui-icon-we"></span>
					<p>
						分类
					</p>
				</li>
				<!--<li id="tabbar3" tapmode onclick="randomSwitchBtn(this,'购物车',2)">
					<span class="aui-iconfont aui-icon-favor"></span>
					<p>
						购物车
					</p>
				</li>
				<li id="tabbar4" tapmode onclick="randomSwitchBtn(this,'我的',3)">
					<span class="aui-iconfont aui-icon-my"></span>
					<p>
						我的
					</p>
				</li>-->
			</ul>
		</footer>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript">
		apiready = function() {
			api.parseTapmode();
			var header = $api.byId('aui-header');
			$api.fixStatusBar(header);
			var headerPos = $api.offset(header);
			var body_h = $api.offset($api.dom('body')).h;
			var footer_h = $api.offset($api.byId('aui-footer')).h;
			api.openFrameGroup({
				name : 'footer_tab_demo',
				scrollEnabled : false,
				rect : {
					x : 0,
					y : headerPos.h,
					w : 'auto',
					h : body_h - headerPos.h - footer_h
				},
				index : 0,
				preload : 3,
				frames : [{
					name : 'shop_home_frm',
					url : 'shop_home_frm.html',
					bounces : true
				}, {
					name : 'shop_fl_frm',
					url : 'shop_fl_frm.html',
					bounces : true
				}/*, {
					name : 'shop_cart_frm',
					url : 'shop_cart_frm.html',
					bounces : true
				}, {
					name : 'user',
					url : '../../html/user/user_win.html',
					bounces : true
				}*/]
			}, function(ret, err) {
				var footer = $api.byId('aui-footer');
				var footerAct = $api.dom(footer, '.aui-bar-tab li.active-warning');
				$api.removeCls(footerAct, 'active-warning');
				var name = ret.name;
				var index = ret.index;
				if (index == 0) {
					$api.text($api.byId('header-title'), '拾昧商城');
					$api.addCls($api.byId('tabbar1'), 'active-warning');
				} else if (index == 1) {
					$api.text($api.byId('header-title'), '分类');
					$api.addCls($api.byId('tabbar2'), 'active-warning');
				} /*else if (index == 2) {
					$api.text($api.byId('header-title'), '购物车');
					$api.addCls($api.byId('tabbar3'), 'active-warning');
				} else if (index == 3) {
					$api.text($api.byId('header-title'), '我的');
					$api.addCls($api.byId('tabbar4'), 'active-warning');
				}*/
			});
		}
		function closeWin() {
			api.closeWin();
		}

		function randomSwitchBtn(obj, name, index) {
			$api.text($api.byId('header-title'), name);
			var footer = $api.byId('aui-footer');
			var footerAct = $api.dom(footer, '.aui-bar-tab li.active-warning');
			$api.removeCls(footerAct, 'active-warning');
			$api.addCls(obj, 'active-warning');
			api.setFrameGroupIndex({
				name : 'footer_tab_demo',
				index : index,
				scroll : true
			});
		}

		function news() {
			var delay = 0;
			if (api.systemType != 'ios') {
				delay = 300;
			}
			api.openWin({
				name : 'news_win',
				url : '../../html/news/news_win.html',
				bounces : false,
				delay : delay,
				slidBackEnabled : true,
				vScrollBarEnabled : false
			});
		}
	</script>
</html>